package com.example.demo;

import reactor.core.publisher.Flux;

/**
 * @author fanhb on 2020/7/28
 * @desc xxxx
 */
public class FLuxDemo {

    public static void main(String[] args) {
        Flux<String> flux = Flux.generate(() -> 0, // 数据源 象
                (value, sink) -> { // value 为当前执行的值，sink 是 单信号 Subscriber 的抽

                    sink.next("value : " + value);

                    if (value == 10) sink.complete();
                    return 1;
                });
        flux.take(2).subscribe(o->{});
    }
}
